home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / hdf / unix / hdf3_2r2.lha / HDF3.2r2 / src / hdf.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-29  |  15.4 KB  |  430 lines

  1. /***************************************************************************
  2. *
  3. *
  4. *                         NCSA HDF version 3.2r2
  5. *                            October 30, 1992
  6. *
  7. * NCSA HDF Version 3.2 source code and documentation are in the public
  8. * domain.  Specifically, we give to the public domain all rights for future
  9. * licensing of the source code, all resale rights, and all publishing rights.
  10. *
  11. * We ask, but do not require, that the following message be included in all
  12. * derived works:
  13. *
  14. * Portions developed at the National Center for Supercomputing Applications at
  15. * the University of Illinois at Urbana-Champaign, in collaboration with the
  16. * Information Technology Institute of Singapore.
  17. *
  18. * THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
  19. * SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
  20. * WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
  21. *
  22. ****************************************************************************
  23. */
  24.  
  25. /*
  26. $Header: /hdf/hdf/v3.2r2/src/RCS/hdf.h,v 1.5 1992/10/23 00:14:11 koziol beta koziol $
  27.  
  28. $Log: hdf.h,v $
  29.  * Revision 1.5  1992/10/23  00:14:11  koziol
  30.  * Changed all DFIstr*() and DFImem*() calls to HDstr*() and HDmem*() calls
  31.  * #ifdef'd out the macros Jason defined for Hopen, Hclose, etc. for Vsets
  32.  * Replaced Vset VFREESPACE and VGETSPACE calls with actual calls to HDfreespace
  33.  * and HDgetspace
  34.  * Added a MS-Windows lower lower for file I/O (which may not be completely working
  35.  *
  36.  * Revision 1.3  1992/10/12  18:11:51  koziol
  37.  * Updated for v3.2r2 release
  38.  *
  39.  * Revision 1.2  1992/08/31  16:16:45  chouck
  40.  * Added definition of calibration tag (731)
  41.  *
  42.  * Revision 1.1  1992/08/25  21:40:44  koziol
  43.  * Initial revision
  44.  *
  45. */
  46. #ifndef HDF_H
  47. #define HDF_H
  48.  
  49. #include "hdfi.h"
  50.  
  51. #ifdef PROTO
  52. #undef PROTO
  53. #endif /* PROTO */
  54. #ifdef PROTOTYPE
  55. #define    PROTO(x) x
  56. #else
  57. #define    PROTO(x) ()
  58. #endif
  59.  
  60. typedef struct {
  61.     uint16 tag, ref;
  62. } DFdi;
  63.  
  64. /* internal file access codes */
  65.  
  66. #define DFACC_READ 1
  67. #define DFACC_WRITE 2
  68. #define DFACC_CREATE 4
  69. #define DFACC_ALL 7
  70.  
  71. #define DFACC_RDONLY 1
  72. #define DFACC_RDWR 3
  73. #define DFACC_CLOBBER 4
  74.  
  75. /* used by Hnextread to determine where to start searching for the
  76.    next tag/ref to read */
  77.  
  78. #define DF_START 0
  79. #define DF_CURRENT 1
  80. #define DF_END 2
  81.  
  82. /* return code - since some unix/c routines use 0 and -1 as their return
  83.    code, and some assumption had been made in the code about that, it is
  84.    important to keep these constants the same values.  For explicitly
  85.    boolean functions, use TRUE and FALSE */
  86.  
  87. #define SUCCEED 0
  88. #define FAIL (-1)
  89.  
  90. /* boolean values,  reminder: NEVER compare with numeric values */
  91.  
  92. #ifndef FALSE
  93. #   define FALSE 0
  94. #endif
  95. #ifndef TRUE
  96. #   define TRUE (!FALSE)
  97. #endif
  98.  
  99. #ifndef NULL
  100. #   define NULL (void *)0
  101. #endif
  102.  
  103. /* macros */
  104.  
  105. #ifdef WIN3
  106. #define STREQ(s, t) (_fstrcmp((s), (t)) == 0)
  107. #define NSTREQ(s, t, n) (_fstrncmp((s), (t), (n)) == 0)
  108. #else
  109. #define STREQ(s, t) (strcmp((s), (t)) == 0)
  110. #define NSTREQ(s, t, n) (strncmp((s), (t), (n)) == 0)
  111. #endif
  112.  
  113.  
  114. #ifndef PRIVATE
  115. #   define PRIVATE static
  116. #endif
  117. #ifndef PUBLIC
  118. #define PUBLIC  /* nothing */
  119. #endif
  120.  
  121. /* functions declarations */
  122.  
  123.  
  124. /* masks for types */
  125.  
  126. #define DFNT_HDF      0x00000000    /* standard HDF format */
  127. #define DFNT_NATIVE   0x00001000    /* native format       */
  128. #define DFNT_CUSTOM   0x00002000    /* custom format       */
  129.  
  130. /* type info codes */
  131.  
  132. #define DFNT_NONE        0    /* indicates that number type not set */
  133. #define DFNT_QUERY       0    /* use this code to find the current type */
  134. #define DFNT_VERSION     1    /* current version of NT info */
  135.  
  136. #define DFNT_FLOAT32     5
  137. #define DFNT_FLOAT       5    /* For backward compat; don't use */
  138. #define DFNT_FLOAT64     6
  139. #define DFNT_DOUBLE      6    /* For backward compat; don't use */
  140. #define DFNT_FLOAT128    7    /* No current plans for support */
  141.  
  142. #define DFNT_INT8       20
  143. #define DFNT_UINT8      21
  144.  
  145. #define DFNT_INT16      22
  146. #define DFNT_UINT16     23
  147. #define DFNT_INT32      24
  148. #define DFNT_UINT32     25
  149. #define DFNT_INT64      26
  150. #define DFNT_UINT64     27
  151. #define DFNT_INT128     28    /* No current plans for support */
  152. #define DFNT_UINT128    30    /* No current plans for support */
  153.  
  154. #define DFNT_UCHAR8      3     /* 3 chosen for backward compatibility */
  155. #define DFNT_UCHAR       3     /* uchar=uchar8 for backward combatibility */
  156. #define DFNT_CHAR8       4     /* 4 chosen for backward compatibility */
  157. #define DFNT_CHAR        4     /* uchar=uchar8 for backward combatibility */
  158. #define DFNT_CHAR16     42     /* No current plans for support */
  159. #define DFNT_UCHAR16    43     /* No current plans for support */
  160.  
  161. #define DFNT_NFLOAT32   (DFNT_NATIVE | DFNT_FLOAT32)
  162. #define DFNT_NFLOAT64   (DFNT_NATIVE | DFNT_FLOAT64)
  163. #define DFNT_NFLOAT128  (DFNT_NATIVE | DFNT_FLOAT128)  /* Unsupported */
  164.  
  165. #define DFNT_NINT8      (DFNT_NATIVE | DFNT_INT8)
  166. #define DFNT_NUINT8     (DFNT_NATIVE | DFNT_UINT8)
  167. #define DFNT_NINT16     (DFNT_NATIVE | DFNT_INT16)
  168. #define DFNT_NUINT16    (DFNT_NATIVE | DFNT_UINT16)
  169. #define DFNT_NINT32     (DFNT_NATIVE | DFNT_INT32)
  170. #define DFNT_NUINT32    (DFNT_NATIVE | DFNT_UINT32)
  171. #define DFNT_NINT64     (DFNT_NATIVE | DFNT_INT64)
  172. #define DFNT_NUINT64    (DFNT_NATIVE | DFNT_UINT64)
  173. #define DFNT_NINT128    (DFNT_NATIVE | DFNT_INT128)   /* Unsupported */
  174. #define DFNT_NUINT128   (DFNT_NATIVE | DFNT_UINT128)  /* Unsupported */
  175.  
  176. #define DFNT_NCHAR8     (DFNT_NATIVE | DFNT_CHAR8)
  177. #define DFNT_NCHAR      (DFNT_NATIVE | DFNT_CHAR8)  /* backward compat */
  178. #define DFNT_NUCHAR8    (DFNT_NATIVE | DFNT_UCHAR8)
  179. #define DFNT_NUCHAR     (DFNT_NATIVE | DFNT_UCHAR8) /* backward compat */
  180. #define DFNT_NCHAR16    (DFNT_NATIVE | DFNT_CHAR16)   /* Unsupported */
  181. #define DFNT_NUCHAR16   (DFNT_NATIVE | DFNT_UCHAR16)   /* Unsupported */
  182.  
  183. /* class info codes for int */
  184. #define        DFNTI_MBO       1       /* Motorola byte order 2's compl */
  185. #define        DFNTI_VBO       2       /* Vax byte order 2's compl */
  186. #define        DFNTI_IBO       4       /* Intel byte order 2's compl */
  187.  
  188. /* class info codes for float */
  189. #define        DFNTF_NONE      0       /* indicates subclass is not set */
  190. #define        DFNTF_HDFDEFAULT 1      /* hdf default float format is ieee */
  191. #define        DFNTF_IEEE      1       /* IEEE format */
  192. #define        DFNTF_VAX       2       /* Vax format */
  193. #define        DFNTF_CRAY      3       /* Cray format */
  194. #define        DFNTF_PC        4       /* PC floats - flipped IEEE */
  195. #define        DFNTF_CONVEX    5       /* CONVEX native format */
  196.  
  197. /* class info codes for char */
  198. #define        DFNTC_BYTE      0       /* bitwise/numeric field */
  199. #define        DFNTC_ASCII     1       /* ASCII */
  200. #define        DFNTC_EBCDIC    5       /* EBCDIC */
  201.  
  202. /* array order */
  203. #define        DFO_FORTRAN     1       /* column major order */
  204. #define        DFO_C           2       /* row major order */
  205.  
  206. /*******************************************************************/
  207. /* Sizes of number types                                            */
  208. /*******************************************************************/
  209.  
  210. /* first the standard sizes of number types */
  211.  
  212. #    define SIZE_FLOAT32    4
  213. #    define SIZE_FLOAT64    8
  214. #    define SIZE_FLOAT128  16    /* No current plans for support */
  215.  
  216. #    define SIZE_INT8       1
  217. #    define SIZE_UINT8      1
  218. #    define SIZE_INT16      2
  219. #    define SIZE_UINT16     2
  220. #    define SIZE_INT32      4
  221. #    define SIZE_UINT32     4
  222. #    define SIZE_INT64      8
  223. #    define SIZE_UINT64     8
  224. #    define SIZE_INT128    16   /* No current plans for support */
  225. #    define SIZE_UINT128   16   /* No current plans for support */
  226.  
  227. #    define SIZE_CHAR8      1
  228. #    define SIZE_CHAR       1    /* For backward compat char8 == char */
  229. #    define SIZE_UCHAR8     1
  230. #    define SIZE_UCHAR      1    /* For backward compat uchar8 == uchar */
  231. #    define SIZE_CHAR16     2    /* No current plans for support */
  232. #    define SIZE_UCHAR16    2    /* No current plans for support */
  233.  
  234. /* then the native sizes of number types */
  235.  
  236. #if !defined(UNICOS)
  237. #    define SIZE_NFLOAT32    4
  238. #    define SIZE_NFLOAT64    8
  239. #    define SIZE_NFLOAT128  16    /* No current plans for support */
  240.  
  241. #    define SIZE_NINT8       1
  242. #    define SIZE_NUINT8      1
  243. #    define SIZE_NINT16      2
  244. #    define SIZE_NUINT16     2
  245. #    define SIZE_NINT32      4
  246. #    define SIZE_NUINT32     4
  247. #    define SIZE_NINT64      8
  248. #    define SIZE_NUINT64     8
  249. #    define SIZE_NINT128    16   /* No current plans for support */
  250. #    define SIZE_NUINT128   16   /* No current plans for support */
  251.  
  252. #    define SIZE_NCHAR8      1
  253. #    define SIZE_NCHAR       1    /* For backward compat char8 == char */
  254. #    define SIZE_NUCHAR8     1
  255. #    define SIZE_NUCHAR      1    /* For backward compat uchar8 == uchar */
  256. #    define SIZE_NCHAR16     2    /* No current plans for support */
  257. #    define SIZE_NUCHAR16    2    /* No current plans for support */
  258. #else  /* !!!!!! SOMEBODY NEEDS TO CHECK THESE !!!!! */
  259. #    define SIZE_NFLOAT32    8
  260. #    define SIZE_NFLOAT64    8
  261. #    define SIZE_NFLOAT128  16    /* No current plans for support */
  262.  
  263. #    define SIZE_NINT8       1
  264. #    define SIZE_NUINT8      1
  265. #    define SIZE_NINT16      8
  266. #    define SIZE_NUINT16     8
  267. #    define SIZE_NINT32      8
  268. #    define SIZE_NUINT32     8
  269. #    define SIZE_NINT64      8
  270. #    define SIZE_NUINT64     8
  271. #    define SIZE_NINT128    16   /* No current plans for support */
  272. #    define SIZE_NUINT128   16   /* No current plans for support */
  273. #    define SIZE_NCHAR8      1
  274. #    define SIZE_NCHAR       1
  275. #    define SIZE_NCHAR       1    /* For backward compat char8 == char */
  276. #    define SIZE_NUCHAR8     1
  277. #    define SIZE_NUCHAR      8    /* For backward compat uchar8 == uchar */
  278. #    define SIZE_NCHAR16     8    /* No current plans for support */
  279. #    define SIZE_NUCHAR16    2    /* No current plans for support */
  280. #endif /* UNICOS */
  281.  
  282.           /* sizes of different number types */
  283. #          define MACHINE_I8_SIZE     1
  284. #          define MACHINE_I16_SIZE    2
  285. #          define MACHINE_I32_SIZE    4
  286. #          define MACHINE_F32_SIZE    4
  287. #          define MACHINE_F64_SIZE    8
  288.  
  289. /* tbuf used as a temporary buffer for small jobs.  The size is
  290.    preferably > 512 but MUST be > ~256.  It is advised that if an
  291.    arbitrarily large buffer (> 100 bytes) is require, dynamic space be
  292.    used.  tbuf lives in the hfile.c */
  293.  
  294. #ifndef TBUF_SZ
  295. #   define TBUF_SZ 1024
  296. #endif
  297.  
  298. extern uint8 *tbuf;
  299.  
  300. /* tags and refs */
  301. #define DFREF_WILDCARD 0
  302. #define DFTAG_WILDCARD 0
  303. #define DFTAG_NULL 1
  304. #define DFTAG_LINKED 20         /* check uniqueness */
  305. #define DFTAG_VERSION 30
  306.  
  307. /* utility set */
  308. #define DFTAG_FID   ((uint16)100) /* File identifier */
  309. #define DFTAG_FD    ((uint16)101) /* File description */
  310. #define DFTAG_TID   ((uint16)102) /* Tag identifier */
  311. #define DFTAG_TD    ((uint16)103) /* Tag descriptor */
  312. #define DFTAG_DIL   ((uint16)104) /* data identifier label */
  313. #define DFTAG_DIA   ((uint16)105) /* data identifier annotation */
  314. #define DFTAG_NT    ((uint16)106) /* number type */
  315. #define DFTAG_MT    ((uint16)107) /* machine type */
  316.  
  317. /* raster-8 set */
  318. #define DFTAG_ID8   ((uint16)200) /* 8-bit Image dimension */
  319. #define DFTAG_IP8   ((uint16)201) /* 8-bit Image palette */
  320. #define DFTAG_RI8   ((uint16)202) /* Raster-8 image */
  321. #define DFTAG_CI8   ((uint16)203) /* RLE compressed 8-bit image */
  322. #define DFTAG_II8   ((uint16)204) /* IMCOMP compressed 8-bit image */
  323.  
  324. /* Raster Image set */
  325. #define DFTAG_ID    ((uint16)300) /* Image DimRec */
  326. #define DFTAG_LUT   ((uint16)301) /* Image Palette */
  327. #define DFTAG_RI    ((uint16)302) /* Raster Image */
  328. #define DFTAG_CI    ((uint16)303) /* Compressed Image */
  329.  
  330. #define DFTAG_RIG   ((uint16)306) /* Raster Image Group */
  331. #define DFTAG_LD    ((uint16)307) /* Palette DimRec */
  332. #define DFTAG_MD    ((uint16)308) /* Matte DimRec */
  333. #define DFTAG_MA    ((uint16)309) /* Matte Data */
  334. #define DFTAG_CCN   ((uint16)310) /* color correction */
  335. #define DFTAG_CFM   ((uint16)311) /* color format */
  336. #define DFTAG_AR    ((uint16)312) /* aspect ratio */
  337.  
  338. #define DFTAG_DRAW  ((uint16)400) /* Draw these images in sequence */
  339. #define DFTAG_RUN   ((uint16)401) /* run this as a program/script */
  340.  
  341. #define DFTAG_XYP   ((uint16)500) /* x-y position */
  342. #define DFTAG_MTO   ((uint16)501) /* machine-type override */
  343.  
  344. /* Tektronix */
  345. #define DFTAG_T14   ((uint16)602) /* TEK 4014 data */
  346. #define DFTAG_T105  ((uint16)603) /* TEK 4105 data */
  347.  
  348. /* Scientific Data set */
  349. #define DFTAG_SDG   ((uint16)700) /* Scientific Data Group */
  350. #define DFTAG_SDD   ((uint16)701) /* Scientific Data DimRec */
  351. #define DFTAG_SD    ((uint16)702) /* Scientific Data */
  352. #define DFTAG_SDS   ((uint16)703) /* Scales */
  353. #define DFTAG_SDL   ((uint16)704) /* Labels */
  354. #define DFTAG_SDU   ((uint16)705) /* Units */
  355. #define DFTAG_SDF   ((uint16)706) /* Formats */
  356. #define DFTAG_SDM   ((uint16)707) /* Max/Min */
  357. #define DFTAG_SDC   ((uint16)708) /* Coord sys */
  358. #define DFTAG_SDT   ((uint16)709) /* Transpose */
  359. #define DFTAG_SDLNK ((uint16)710) /* Links related to the dataset */
  360. #define DFTAG_NDG   ((uint16)720) /* Numeric Data Group */
  361. #define DFTAG_CAL   ((uint16)731) /* Calibration information */
  362. #define DFTAG_BREQ  ((uint16)799) /* Beginning of required tags   */
  363. #define DFTAG_EREQ  ((uint16)780) /* Current end of the range   */
  364.  
  365. /* VSets */
  366. #define DFTAG_VG     ((uint16)1965) /* Vgroup */
  367. #define DFTAG_VH     ((uint16)1962) /* Vdata Header */
  368. #define DFTAG_VS     ((uint16)1963) /* Vdata Storage */
  369.  
  370. /* compression schemes */
  371. #define DFTAG_RLE   ((uint16)11) /* run length encoding */
  372. #define DFTAG_IMC   ((uint16)12) /* IMCOMP compression */
  373. #define DFTAG_IMCOMP   ((uint16)12) /* IMCOMP compression */
  374.  
  375. /* SPECIAL CODES */
  376. #define SPECIAL_LINKED 1
  377. #define SPECIAL_EXT 2
  378.  
  379. /* PARAMETERS */
  380.  
  381. #define DF_MAXFNLEN 256
  382.  
  383. /* .................................................................. */
  384.  
  385. /* MACROS for Hinquire. feb-2-92 */
  386.  
  387. #define HQueryfileid(aid, fileid)      \
  388.   (Hinquire ((int32)   aid,  (int32*) fileid, (uint16*) NULL,\
  389.              (uint16*) NULL, (int32*) NULL,   (int32*)  NULL,\
  390.              (int32*)  NULL, (int16*) NULL,   (int16*)  NULL))
  391.  
  392. #define HQuerytagref(aid, tag, ref)    \
  393.   (Hinquire ((int32)   aid,  (int32*) NULL,   (uint16*) tag,\
  394.              (uint16*) ref,  (int32*) NULL,   (int32*)  NULL,\
  395.              (int32*)  NULL, (int16*) NULL,   (int16*)  NULL))
  396.  
  397. #define HQuerylength(aid, length)      \
  398.   (Hinquire ((int32)    aid, (int32*) NULL,    (uint16*) NULL,      \
  399.              (uint16*) NULL, (int32*) length,    (int32*)  NULL,      \
  400.              (int32*)  NULL, (int16*) NULL,    (int16*)  NULL))
  401.  
  402. #define HQueryoffset(aid, offset)      \
  403.   (Hinquire ((int32)     aid, (int32*) NULL,    (uint16*) NULL,      \
  404.              (uint16*) NULL, (int32*) NULL,     (int32*)  offset, \
  405.              (int32*)  NULL, (int16*) NULL,      (int16*)  NULL))
  406.  
  407. #define HQueryposition(aid, position) \
  408.   (Hinquire ((int32)     aid, (int32*) NULL,    (uint16*) NULL,      \
  409.              (uint16*) NULL, (int32*) NULL,    (int32*)  NULL,      \
  410.              (int32*) position, (int16*) NULL,    (int16*)  NULL))
  411.  
  412. #define HQueryaccess(aid, access)      \
  413.   (Hinquire ((int32)     aid,    (int32*) NULL,     (uint16*) NULL,  \
  414.              (uint16*) NULL,    (int32*) NULL,     (int32*)  NULL,  \
  415.              (int32*)     NULL,     (int16*) access, (int16*)  NULL))
  416.  
  417. #define HQueryspecial(aid, special)    \
  418.   (Hinquire ((int32)     aid,    (int32*) NULL,    (uint16*) NULL,      \
  419.              (uint16*) NULL,    (int32*) NULL,    (int32*)  NULL,      \
  420.              (int32*)     NULL,    (int16*) NULL,    (int16*)  special))
  421.  
  422. /* .................................................................. */
  423.  
  424. /* Publically accessible functions declarations.  This includes all the
  425.    functions that are used by application programs.  */
  426.  
  427. #include "hproto.h"
  428.  
  429. #endif /* HDF_H */
  430.